﻿namespace Services;

public class AutoFacManager : Autofac.Module
{
    //重写Autofac管道Load方法，注册注入
    protected override void Load(ContainerBuilder builder)
    {
        //程序集注入业务服务
        var assemblies = Assembly.GetExecutingAssembly();
        //根据名称约定（服务层的接口和实现均以BLL结尾），实现服务接口和服务实现的依赖
        builder.RegisterAssemblyTypes(assemblies).Where(t => t.Name.EndsWith("BLL")).AsImplementedInterfaces();
    }
}
